Swap on Orca
Swap Between Tokens on Orca
Networks Supported:
- solana-mainnet
Endpoint
POST
/api/v0/defi/solana/orca-swap/<YOUR_API_KEY>
Test API Key
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IkZJMHljR2kwYWhYRFplQmtleEFFZm1jVzZ1NTMiLCJpYXQiOjE2NzM1OTQ1NjF9.CI2QEG7Ek6juzthOuV4NAstYKPHerzRXRUPpA1B9sb4
Request Body
Field | Type | Description |
---|---|---|
authority | array | The authority secret key array |
tokenPair | json | The token pair to swap between. Contains symbols of the tokens |
tokenToSwap | string | Symbol of the token to swap |
amountToSwap | string | Amount of the token to swap |
Code Sample
index.js
const { default: axios } = require("axios");
const authority = [...]
const tokenPair = {
firstToken: 'SOL',
secondToken: 'USDC'
};
const tokenToSwap = 'SOL';
const amountToSwap = 1.6;
const swap = async () => {
axios({
method: 'POST',
url: 'https://app.conciselabs.io/api/v0/defi/solana/orca-swap/<YOUR_API_KEY>',
data: {
authority,
tokenPair,
tokenToSwap,
amountToSwap
},
headers: {
"content-type": "application/json"
}
}).then((response) => {
console.log(response.data);
}).catch((err) => {
console.log(err)
})
}
Response
{
"swapTransactionId": "4PtecZtiJBLQqi3pGGUp1F6ZS3aWHCqvLp5Ntjmk1CixF5mN6cpc52yBc8q2C8P4y1bHfzMqvNqbRfqcrkFLpR1g"
}